<form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Group')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_select('group[]', $groupdata, null, ['class'=>'form-control selectpicker', 'multiple'=>'', 'data-rule'=>'required'])}
        </div>
    </div>
    <div class="form-group">
        <label for="username" class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="text" class="form-control" id="username" name="row[username]" value="" data-rule="required;username" />
        </div>
    </div>
    <div class="form-group">
        <label for="email" class="control-label col-xs-12 col-sm-2">{:__('Email')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="email" class="form-control" id="email" name="row[email]" value="" data-rule="required;email" />
        </div>
    </div>
    <div class="form-group">
        <label for="nickname" class="control-label col-xs-12 col-sm-2">{:__('Nickname')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="text" class="form-control" id="nickname" name="row[nickname]" autocomplete="off" value="" data-rule="required" />
        </div>
    </div>
    <div class="form-group">
        <label for="password" class="control-label col-xs-12 col-sm-2">{:__('Password')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="password" class="form-control" id="password" name="row[password]" autocomplete="new-password" value="" data-rule="required;password" />
        </div>
    </div>
    <div class="form-group">
        <label for="nickname" class="control-label col-xs-12 col-sm-2">{:__('備註')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="text" class="form-control" id="remark" name="row[remark]" autocomplete="off" value="" data-rule="required" />
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')])}
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('區域1')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="form-inline" data-toggle="cxselect" data-selects="xianshi,xzq">
                <select class="xianshi form-control" name="row[xianshi1]" data-url="jdy/anchang/cxselect?type=xianshi"></select>
                <select class="xzq form-control" name="row[xzq1]" data-url="jdy/anchang/cxselect?type=xzq" data-query-name="xianshi"></select>
                <input type="hidden" class="operate" data-name="xianshi" value="=" />
                <input type="hidden" class="operate" data-name="xzq" value="=" />
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('區域2')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="form-inline" data-toggle="cxselect" data-selects="xianshi,xzq">
                <select class="xianshi form-control" name="row[xianshi2]" data-url="jdy/anchang/cxselect?type=xianshi"></select>
                <select class="xzq form-control" name="row[xzq2]" data-url="jdy/anchang/cxselect?type=xzq" data-query-name="xianshi"></select>
                <input type="hidden" class="operate" data-name="xianshi" value="=" />
                <input type="hidden" class="operate" data-name="xzq" value="=" />
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('區域3')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="form-inline" data-toggle="cxselect" data-selects="xianshi,xzq">
                <select class="xianshi form-control" name="row[xianshi3]" data-url="jdy/anchang/cxselect?type=xianshi"></select>
                <select class="xzq form-control" name="row[xzq3]" data-url="jdy/anchang/cxselect?type=xzq" data-query-name="xianshi"></select>
                <input type="hidden" class="operate" data-name="xianshi" value="=" />
                <input type="hidden" class="operate" data-name="xzq" value="=" />
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('區域4')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="form-inline" data-toggle="cxselect" data-selects="xianshi,xzq">
                <select class="xianshi form-control" name="row[xianshi4]" data-url="jdy/anchang/cxselect?type=xianshi"></select>
                <select class="xzq form-control" name="row[xzq4]" data-url="jdy/anchang/cxselect?type=xzq" data-query-name="xianshi"></select>
                <input type="hidden" class="operate" data-name="xianshi" value="=" />
                <input type="hidden" class="operate" data-name="xzq" value="=" />
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('區域5')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="form-inline" data-toggle="cxselect" data-selects="xianshi,xzq">
                <select class="xianshi form-control" name="row[xianshi5]" data-url="jdy/anchang/cxselect?type=xianshi"></select>
                <select class="xzq form-control" name="row[xzq5]" data-url="jdy/anchang/cxselect?type=xzq" data-query-name="xianshi"></select>
                <input type="hidden" class="operate" data-name="xianshi" value="=" />
                <input type="hidden" class="operate" data-name="xzq" value="=" />
            </div>
        </div>
    </div>

    <div class="form-group row">
        <label class="control-label col-xs-12 col-sm-2">{:__('案場')}:</label>
        <div class="col-xs-12 col-sm-10">
            <dl class="fieldlist" data-template="eventtpl" data-name="row[anchangids]">
                <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
                <!--請註意 dd和textarea間不能存在其它任何元素，實際開發中textarea應該添加個hidden進行隱藏-->
                <textarea name="row[anchangids]" class="form-control hide"  cols="30" rows="5"></textarea>
            </dl>
            <script id="eventtpl" type="text/html">
                <dd class="form-inline" >
                    <input type="text" style="width: 360px;" name="<%=name%>[<%=index%>][id]" class="form-control selectpage" data-source="jdy/anchang/selectpage2" data-field="name" value="<%=row.id%>" placeholder="案場" size="30"/>
                    <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                </dd>
            </script>
        </div>
    </div>


    <div class="form-group hidden layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

